#pragma once

#include "PropertyVisitor.hpp"

CYBERTRON_BEGIN

class PropertyVisitorXmlIOImpl;

class PropertyVisitorXmlIO : public PropertyVisitor
{
public:
	CybertronCoreAPI PropertyVisitorXmlIO();
	CybertronCoreAPI virtual ~PropertyVisitorXmlIO();

	CybertronCoreAPI void clear();
	CybertronCoreAPI bool openStringWrite();
	CybertronCoreAPI std::string getStringWrite() const;
	CybertronCoreAPI bool openStringRead(const std::string& xmlContent);

	CybertronCoreAPI virtual std::string getData();
	CybertronCoreAPI virtual void setData(const std::string& val);

	CybertronCoreAPI virtual bool visitProperty(const std::string& propertyName, bool& val);
	CybertronCoreAPI virtual bool visitProperty(const std::string& propertyName, int& val);
	CybertronCoreAPI virtual bool visitProperty(const std::string& propertyName, unsigned int& val);
	CybertronCoreAPI virtual bool visitProperty(const std::string& propertyName, double& val);
	CybertronCoreAPI virtual bool visitProperty(const std::string& propertyName, std::string& val);

	CybertronCoreAPI virtual size_t getChildSize(const std::string& propertyName);
	CybertronCoreAPI virtual PropertyVisitor* getChild(const std::string& propertyName, size_t i);
	CybertronCoreAPI virtual PropertyVisitor* addChild(const std::string& propertyName);

private:
	std::vector<std::shared_ptr<PropertyVisitorXmlIO>>& buildChildCacheOnLoad(const std::string& propertyName);

private:
	PropertyVisitorXmlIOImpl* mpImpl;
};

CYBERTRON_END
